/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package funda.appius.Avance.Real;

import funda.appius.arquitectura.AbstractFunda;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author payo
 */
public class AvanceDeObra extends AbstractFunda{
    
    private int Numero,IdAvanceReal,IdAvanceDeObra;

    public void setCantidad(double Cantidad) {
        this.Cantidad = Cantidad;
    }

    public void setIdAvanceDeObra(int IdAvanceDeObra) {
        this.IdAvanceDeObra = IdAvanceDeObra;
    }

    public void setIdAvanceReal(int IdAvanceReal) {
        this.IdAvanceReal = IdAvanceReal;
    }

    public void setNumero(int Numero) {
        this.Numero = Numero;
    }

    public double getCantidad() {
        return Cantidad;
    }

    public int getIdAvanceDeObra() {
        return IdAvanceDeObra;
    }

    public int getIdAvanceReal() {
        return IdAvanceReal;
    }

    public int getNumero() {
        return Numero;
    }
    private double Cantidad;
    
    public AvanceDeObra()
    {
        super();
    }

    public AvanceDeObra(int Numero, int IdAvanceReal, double Cantidad) {
        super();
        this.Numero = Numero;
        this.IdAvanceReal = IdAvanceReal;
        this.Cantidad = Cantidad;
        this.IdAvanceDeObra = Integer.parseInt(insertarId().toString());
    }

    @Override
    protected void fillFunda(ResultSet row) {
        try{
            int x=0;
            this.IdAvanceDeObra = row.getInt(++x);
            this.Numero = row.getInt(++x);
            this.IdAvanceReal = row.getInt(++x);
            this.Cantidad = row.getDouble(++x);
        }
        catch(Exception e){}
    }

    @Override
    protected void Comandos() {
        this.id = "IdAvanceDeObra";
        this.tabla = "avancedeobra";
        this.strDelete = "DeleteAvanceDeObra";
        this.strInsertar = "InsertarAvanceDeObra";
        this.strInsertarId = "InsertarIdAvanceDeObra";
        this.strUpdate = "UpdateAvanceDeObra";
    }

    @Override
    public ArrayList<Object> getAtributos() {
        ArrayList<Object> lst = new ArrayList<Object>();
        lst.add(Numero);
        lst.add(Cantidad);
        lst.add(IdAvanceReal);
        lst.add(IdAvanceDeObra);
        return lst;
    }
    
     @Override
    public AvanceDeObra get(Object id) {
        AbstractFunda abs = AbstractFunda.getAbstractFunda(new AvanceDeObra(),id,tabla,this.id);
        AvanceDeObra c = (AvanceDeObra)abs;
        return c;
    }
    
    public ArrayList<AvanceDeObra> getAll() {
        List<AbstractFunda> abs = AbstractFunda.getAll(tabla,id,this.getClass());
        ArrayList<AvanceDeObra> lst = new ArrayList<AvanceDeObra>();
        for(AbstractFunda af : abs)
            lst.add((AvanceDeObra)af);
        return lst;
    }
    
}
